<script>

function option_element(name, value){
	this.name = name;
	this.value = value;
}

function populateSelect(el, items) {
    el.options.length = 0;
    if (items.length > 0)
        el.options[0] = new Option('--<?php echo __("Select")?>--', '');

    $.each(items, function () {
        el.options[el.options.length] = new Option(this.name, this.value);
    });
}

var options_arr = new Array();


<?php foreach ($contents as $content) {
	?>
	var new_option = new option_element("<?php echo $content->getName();?>", "<?php echo $content->getId();?>");
	options_arr.push(new_option);
	<?php 
	}	
?>


var sl_to_refresh = document.getElementById("<?php echo $select_name?>");

populateSelect(sl_to_refresh,options_arr);
</script>